import { BaseWindow } from "../../../component/window/BaseWindow";
import { Language } from "../../../../extend/language/Language";
import { SSpiritCoinReturnInfo } from "../../../../Message/Public/SSpiritCoinReturnInfo";
import { ObjCreate } from "../common/ObjCreate";
import { SpiritEquipCoinReturnCellRenderer } from "./SpiritEquipCoinReturnCellRenderer";
import { DataProvider } from "../../../../fl/data/DataProvider";
import { GlobalStyle } from "../../../common/global/GlobalStyle";
import { LayerManager } from "../../manager/LayerManager";
import { EffectManager } from "../../manager/EffectManager";
import { KeyBoardManager } from "../../../../com/gengine/keyBoard/KeyBoardManager";
import { GTextFiled } from "../../../../com/mui/controls/GTextFiled";
import { GTileList } from "../../../../com/mui/controls/GTileList";
import { GButton } from "../../../../com/mui/controls/GButton";
type int = number;
//class SpiritEquipCoinReturnWindow
    
    export  class SpiritEquipCoinReturnWindow extends BaseWindow
    {
        constructor()
        {
            super();
            setSize(300, 300);
            title = Language.getString(27692);
            titleHeight = 26;
            return;
        }

        public updateByCoinReturnInfo(arg1: SSpiritCoinReturnInfo): void
        {
            var loc1=null;
            var loc2=null;
            var loc3=0;
            if (arg1) 
            {
                this._equipList.dataProvider.removeAll();
                loc2 = arg1.seqReturnSpiritCoinInfos;
                loc3 = 0;
                while (loc3 < loc2.length) 
                {
                    loc1 = (loc2[loc3] as string).split(",");
                    this._equipList.dataProvider.addItem({"itemCode": int(loc1[0]), "strength": loc1[1], "value": loc1[2]});
                    ++loc3;
                }
                this._totalTxt.htmlText = Language.getStringByParam(36646, arg1.totalReturnCount);
            }
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            ObjCreate.createBg(19, 37, 262, 250, this);
            this._tipTxt = ObjCreate.createGTextField("", 30, 40, 249, 20, this);
            this._tipTxt.autoSize = flash.text.TextFieldAutoSize.LEFT;
            this._tipTxt.multiline = true;
            this._tipTxt.wordWrap = true;
            this._tipTxt.htmlText = Language.getString(36647);
            this._equipList = ObjCreate.createTileList(30, 110, 245, 120, this);
            this._equipList.columnWidth = 245;
            this._equipList.rowHeight = 25;
            this._equipList.setStyle("cellRenderer", SpiritEquipCoinReturnCellRenderer);
            this._equipList.dataProvider = new DataProvider([]);
            this._totalTxt = ObjCreate.createGTextField("", 30, 260, 220, 20, this, GlobalStyle.textFormat6);
            this._okButton = ObjCreate.createGButton(Language.getString(28091), 130, 250, 49, 28, this, "Button", this.onOkBtnClickHandler);
            return;
        }

        /* internal  */onOkBtnClickHandler(arg1: Object /* flash.events.MouseEvent */): void
        {
            this.hide();
            return;
        }

        public /* override */ show(arg1: int=0, arg2: int=0): void
        {
            super.show(arg1, arg2);
            LayerManager.highestLayer.addPopUp(this, true);
            LayerManager.highestLayer.centerPopup(this);
            EffectManager.addUIMask([], 0);
            KeyBoardManager.instance.cancelListener();
            return;
        }

        public /* override */ hide(): void
        {
            super.hide();
            LayerManager.highestLayer.removePopup(this);
            EffectManager.hideUIMask();
            KeyBoardManager.instance.addListener();
            return;
        }

        /* internal */ /* var */_tipTxt: GTextFiled;

        /* internal */ /* var */_equipList: GTileList;

        /* internal */ /* var */_totalTxt: GTextFiled;

        /* internal */ /* var */_okButton: GButton;
    }
